import java.util.Scanner;

public class Login {
    private static final String userName = "admin";
    private static final String passerWord = "123456";

    public static void main(String[] args) throws UserNameException, PasswordException {
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入用户名：");
        String str1 = sc.nextLine();
        System.out.print("请输入密码：");
        String str2 = sc.nextLine();
        login(str1, str2);
    }

    private static void login(String userName, String passerWord) throws UserNameException, PasswordException {
        if (!Login.userName.equals(userName) || !Login.passerWord.equals(passerWord)){
            throw new UserNameException("用户名密码错误");
        }
        System.out.println("登录成功");
    }
}

